package top.laoshuzi.android.mvp.compiler;

import com.google.auto.service.AutoService;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;

import top.laoshuzi.android.mvp.compiler.processor.BindPresenterProcessor;
import top.laoshuzi.android.mvp.facade.annotation.BindPresenter;

@AutoService(Processor.class)
public class MVPProcessor extends AbstractProcessor {

    @Override
    public Set<String> getSupportedAnnotationTypes() {
        Set<String> set = new LinkedHashSet<>();
        set.add(BindPresenter.class.getCanonicalName());
        return set;
    }

    @Override
    public SourceVersion getSupportedSourceVersion() {
        return SourceVersion.latestSupported();
    }

    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {

        new BindPresenterProcessor(processingEnv).process(annotations, roundEnv);

        return true;
    }


}
